import {
  exportExcelFile,
} from "@/common/utils/GlobalUtils";
import { reactive, ref } from "vue";
import {deriveApi} from '@/api/project';
/**
* @description:一键导出
* @param {type} fileName 文件名称
* @param {type} apiPath 导出url api
* @param {type} param 导出所需参数
* @return:
*/
export const deriveHandelFnc = (
  exportConfig = { fileName: "", apiPath: ""}
) => {

  /**
   * 导出列表数据
   *
   */
  const onExport = (param={}) => {
    deriveApi[exportConfig.apiPath](param).then(
      (res) => {
        if (res) {
          exportExcelFile(res, exportConfig.fileName);
        }
      }
    );
  };

  return {
    onExport
  }
}
